package com.lgx.right.service;

import java.util.List;

import com.lgx.common.exception.DataException;
import com.lgx.common.web.Pagination;
import com.lgx.right.entity.User;
import com.lgx.right.entity.UserExpand;

/**
 * 
 * 
 * @author acer
 *
 */
public interface IUserService {
	public User createUser(User user) throws DataException;
	public User updateUser(User user) throws DataException;
	public UserExpand updateUserAndExpand(User user,UserExpand expand) throws DataException;
	public void deleteUser(User user) throws DataException;
	public void deleteUserById(long id) throws DataException;
	public User findUserById(long id);
	public List<User> findUserByCondition(String name,String param);
	public List<User> findUserList(String sql,Object[] params,int pageSize,int pageNum);
	
	public Pagination findUserPagination(String sql,Object[] params,int pageSize,int pageNum);
	public Pagination findUserPagination(Object[] params,Class<?> clazz,int pageSize,int pageNum);
	
	public User loginUser(String username,String password);
	public boolean checkMobileExists(String mobile);
	public boolean checkUserNameExists(String username);
	
	public Pagination findUserList(String type,long orgId,int usertype,String name,String card,String mobile,
			String registerTimeStar, String registerTimeEnd ,String orgName,String isMaster,int pageSize,int pageNum);
	
	public User createUser(User user,String card) throws DataException;
	public List<User> findUserList(String sql);
	
	public List<User> findActiveUserList(long num);
	
	/**
	 * 修改密码方法，npwd为新密码，opwd为旧密码
	 * 注意：在修改之前，先去数据库查找到这个用户的原密码，如果原密码输入错误，则不允许其修改密码
	 * @param userId
	 * @param npwd
	 * @param opwd
	 * @return
	 * @throws DataException
	 */
	public String modifyPassword(long userId,String npwd,String opwd) throws DataException;
	
	/**
	 * 重置密码方法，重置的新密码有系统生成随机数指定
	 * @param userId
	 * @return
	 * @throws DataException
	 */
	public boolean resetPassword(long userId) throws DataException;
	
	/**
	 * 更新手机方法，此实例实现updateUser方法
	 * @param userId
	 * @return
	 * @throws DataException
	 */
	public User updateUserMobile(Long Userid,String mobile) throws DataException;
}
